package com.zw._01_hello_world;

import com.rabbitmq.client.*;
import com.zw.ConnectionUtil;

import java.io.IOException;

public class Rev {
    public static void main(String[] args) throws Exception {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        DefaultConsumer consumer = new DefaultConsumer(channel){
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println(new String(body));
            }
        };
        channel.basicConsume(Sen.MQ_QUEUE, true, consumer);
    }
}
